/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.then.component.login.api;


import android.arch.lifecycle.LiveData;

import com.then.architecture.data.api.ApiResponse;

import com.then.architecture.data.dto.SimpleEntity;
import com.then.architecture.utils.Retry;
import com.then.component.login.dto.Auth;
import com.then.component.login.dto.Login;
import com.then.component.login.dto.LoginSimpleEntity;
import com.then.component.login.request.CompleteRegisterReq;
import com.then.component.login.request.CompleteFindPwdReq;
import com.then.component.login.request.FindPwdReq;
import com.then.component.login.request.LoginByPhoneReq;
import com.then.component.login.request.RegisterReq;

import java.util.Map;

import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;

/**
 * REST API access points
 */
public interface RemoteService {

    /**
     * 手机号登录
     */
    @Retry(2)
    @POST("regist/phoneLogin")
    LiveData<ApiResponse<Login>> login(@Body LoginByPhoneReq req);

    @GET("regist/isphoneregist")
    LiveData<ApiResponse<LoginSimpleEntity>> isPhoneRegistered(@QueryMap Map<String, String> query);

    @GET("regist/sendsms")
    LiveData<ApiResponse<LoginSimpleEntity>> sendSms(@QueryMap Map<String, String> query);

    @POST("regist/regist")
    LiveData<ApiResponse<Auth>> register(@Body RegisterReq registerReq);

    @POST("regist/phoneFindPwd")
    LiveData<ApiResponse<Auth>> findPwd(@Body FindPwdReq findPwdReq);

    @POST("regist/completePhoneFindPwd")
    LiveData<ApiResponse<Login>> completePhoneFindPwd(@Body CompleteFindPwdReq completeFindPwdReq);

    @POST("regist/completePhoneReg")
    LiveData<ApiResponse<SimpleEntity>> completeRegister(@Body CompleteRegisterReq completeRegisterReq);

    @GET("customer/checknickname")
    LiveData<ApiResponse<SimpleEntity>>  checkNickName(@QueryMap Map<String, String> query);

}
